#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

/*
指针函数：返回值类型是指针的函数

函数指针：指向函数的指针

*/

void test_1()
{
    printf("void test_1()\n");
}

int* test_2()
{
    printf("void test_2()\n");

    return NULL;
}

int* test_3()
{
    printf("void test_3()\n");
    int num=10;
    int* p=&num;
    return p; //返回了栈区变量的首地址（不允许）***在vscode中结果是正常的
}

//函数指针
typedef void funType();

int main()
{
    test_1();
    int* p2=test_2();
    int* p3=test_3();
    printf("p2=%X\n",p2);
    printf("p3=%X\n",p3);
    printf("*p3=%d\n",*p3);

    funType* pFun_1=&test_1;
    (*pFun_1)();

    funType* pFun_2=test_1;
    (*pFun_2)();

    funType* pFun_3=&test_1;
    pFun_3();

    funType* pFun_4=test_1;
    pFun_4();

    void(*pFun) ()=&test_1;
    (*pFun)();

	//system("pause");
	return 0;
} 